package appbase.third.chuanglan;



public class SnsKit {
	
	private static String account = "N5408348";  // 发送短信的账号(非登录账号) (示例:N987654) 
	private static String pswd = "szN5408348";  // 发送短信的密码(非登录密码)
	private static String url = "http://sms.253.com/msg/send";  // "http://sms.253.com/msg/send";应用地址 (无特殊情况时无需修改)
	private static String sign = "253云通讯";  //短信签名【xxxx】
	
	/**
	 * <br>1，config.txt 加入：
	 * #创蓝短信
	   sns_account = N5408348
	   sns_password = szN5408348
	   sns_url = http://sms.253.com/msg/send
	   sns_sign = 茶趣里
	 * <br>2，Appconst.java 调用：
	 * //创蓝短信
		String snsAccount = PropKit.get("sns_account");
		String snsPassword = PropKit.get("sns_password");
		String snsUrl = PropKit.get("sns_url");
		String snsSign = PropKit.get("sns_sign");
		SnsKit.init(snsAccount, snsPassword, snsUrl, snsSign);
	 */
	public static void init(String snsAccount, String snsPassword, String snsUrl, String snsSign)
	{
		account = snsAccount;
		pswd = snsPassword;
		url = snsUrl;
		sign = snsSign;
	}
	
	
	public static void sendMessage(String phone, String msgText)
	{
		String msg = "【" + sign + "】" + msgText; //您的签名+短信内容 
		
		String extno = null;     	// 扩展码(可选参数,可自定义)
		String rd="1";				// 是否需要状态报告(需要:1,不需要:0)
		try {
			    String returnString2 = HttpSender.SendPost(url,account, pswd,msg.toString(),phone,rd,extno); 
			    System.out.println("短信发送结果：" + returnString2);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) 
	{
		String snsAccount = "N6622314";
		String snsPassword = "6IX7EtQk9xa929";
		String snsUrl = "http://sms.253.com/msg/send";
		String snsSign = "帝全";
		init(snsAccount, snsPassword, snsUrl, snsSign);
		
		String msgText = "你有一条关于”小米手机“的及时通推送信息--帝全";
		sendMessage("13428790254", msgText);
	}
}
